<template>
  <div class="container">
    <div v-if="list.length==0" class="list-nodate">暂无数据</div>
    <van-tabs v-else v-model="active">
      <van-tab v-for="classify in list" :key="classify.id" :title="classify.configName">
        <div v-if="classify.relationEntities.length==0" class="list-nodate">暂无数据</div>
        <template v-else v-for="item in classify.relationEntities">
          <video-cell v-if="classify.configType==='video'" :key="item.id" :data="item"></video-cell>
          <subject-cell v-else :key="item.id" :data="item"></subject-cell>
        </template>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script>
// import subjectList from '@/components/subject-list'
import subjectCell from '@/components/subject-cell'
import videoCell from '@/components/video-cell'

export default {
  components: {
    // subjectList,
    subjectCell,
    videoCell
  },
  data () {
    return {
      active: 0,
      list: [],
      subjectId: ''
    }
  },
  created () {
    this.subjectId = this.$route.query.id || '1'
    this.getList()
  },
  methods: {
    getList () {
      this.$axios
        .get('/xbkj-dj/web/subject/getDetailById', {
          subjectId: this.subjectId
        })
        .then(res => {
          console.log(res)
          this.list = res.data.subjectSettingEntities
        })
    }
  }
}
</script>
<style lang="less" scoped>
.container {
  background-color: #fff;
  padding: 0 20px;
}
.van-tabs {
  /deep/ .van-tabs__nav {
    .van-tab--active {
      color: #f0321d;
    }
    .van-tabs__line {
      height: 2px;
      background-color: #f0321d;
    }
  }
}
.list-nodate {
  height: 116px;
  text-align: center;
  line-height: 116px;
  font-size: 14px;
  color: #ccc;
}
</style>
